<?php

namespace iBrand\Component\Order\Models;

use iBrand\Component\MultiGroupon\Models\MultiGroupon;
use Illuminate\Database\Eloquent\Model;
use Prettus\Repository\Contracts\Transformable;
use Prettus\Repository\Traits\TransformableTrait;
use Illuminate\Database\Eloquent\SoftDeletes;
use iBrand\Component\Seckill\Models\SeckillItem;
use iBrand\Component\Suit\Models\Suit;
use iBrand\Component\Groupon\Models\GrouponItem;

class SpecialType extends Model implements Transformable
{
	use SoftDeletes;
	use TransformableTrait;

	protected $table = 'el_order_special_type';

	protected $guarded = ['id'];

	public function order()
	{
		return $this->belongsTo(Order::class);
	}

	public function seckill_item()
	{
		return $this->hasOne(SeckillItem::class, 'id', 'origin_id');
	}

	public function suit()
	{
		return $this->hasOne(Suit::class, 'id', 'origin_id');
	}

	public function groupon_item()
	{
		return $this->hasOne(GrouponItem::class, 'id', 'origin_id');
	}

	public function multiGroupon()
	{
		return $this->belongsTo(MultiGroupon::class, 'origin_id');
	}

}